#pragma once
#include "loadUtils.h"
/**
 * @brief Struct for storing discount data
 */
struct DiscountVars{
	char id[15];
	char desc[30];
	char type[7];
	char status[9];
	int amount;
	char applicability[6];
};
/**
 * @brief Array of DiscountVars structs, allocated dynamically later on
 */
struct DiscountVars *discountdata;

/**
 * @brief keeps count of how many discounts we have, also used for memory reallocation
 */
int discountcount;

/**
 * @brief Load discount file into memory
 *
 * @param filename
 *
 * @return return code
 */
int loadDiscounts(char const *filename);

/**
 * @brief save discountdata to file
 *
 * @param filename
 *
 * @return return code
 */
int writeDiscounts(char const *filename);

/**
 * @brief add a discount to the vector, reallocates if needed
 *
 * @param n
 */
void addDiscount(struct DiscountVars n);

/**
 * @brief removes a discount by index, find it yourself first ;)
 *
 * @param index
 */
void rmDiscount(int index);
